//
//  CustomTabBarController.m
//  UITabarButtonAnimation
//
//  Created by fc_curry on 2017/5/17.
//  Copyright © 2017年 fc_curry. All rights reserved.
//

#import "HomePageViewController.h"
#import "SimpleIFAAViewController.h"
#import <esand_cloud_ifaa/esand_cloud_ifaa.h>
#import "HttpClient.h"

@interface HomePageViewController ()
@property (nonatomic,strong) UIButton *hyAuthBtn;
@end

@implementation HomePageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    // 添加LOGO
    //导航栏+状态栏高度
    CGFloat topHeight = self.navigationController.navigationBar.frame.size.height + [[UIApplication sharedApplication] statusBarFrame].size.height;
    UIImageView *logoView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo@3x"]];
    logoView.frame = CGRectMake(SCREEN_WIDTH/2-50,topHeight+20, 100, 100);
    [self.view addSubview:logoView];

    // SIMPLE IFAA 按钮
    UIButton * simpleIfaaButton = [UIButton buttonWithType:UIButtonTypeCustom];
    //设置IFAA模块按钮布局
    simpleIfaaButton.frame = CGRectMake(10, topHeight + 140 , SCREEN_WIDTH-20, 50) ;
    [simpleIfaaButton setTitle:@"SIMPLE IFAA" forState:UIControlStateNormal];
    //设置按钮文字颜色
    [simpleIfaaButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    //设置按钮背景色
    [simpleIfaaButton setBackgroundColor:[UIColor colorWithRed:239.0/255.0 green:137.0/255.0 blue:47.0/255.0 alpha:1.0]];
    //按钮圆角
    [simpleIfaaButton.layer setCornerRadius:SCREEN_WIDTH/16];
    //设置按钮点击事件
    [simpleIfaaButton addTarget:self action:@selector(simpleIfaa:) forControlEvents:UIControlEventTouchUpInside];
    simpleIfaaButton.accessibilityIdentifier = @"simpleIfaa";
    [self.view addSubview:simpleIfaaButton];

    // 添加一砂页脚
    UIImageView *sloganView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"slogan"]];
    sloganView.frame = CGRectMake(2*SCREEN_WIDTH/7, SCREEN_HEIGHT-80, 3*SCREEN_WIDTH/7, 80);
    [self.view addSubview:sloganView];

}

-(void)viewWillAppear:(BOOL)animated{
    //从设置页面pop回来时，刷新界面
    [super viewWillAppear:animated];
}

-(IBAction)setUp:(id)sender{

}

// IFAA 简化版
-(IBAction)simpleIfaa:(id)sender{
    SimpleIFAAViewController *vc = [[SimpleIFAAViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}


@end
